import React, {Component} from "react";
import About from "./pages/About";
import Home from "./pages/Home";
import {NavLink,Route} from "react-router-dom"

export default class App extends Component {

    render() {
        return (
            <div>
                <div className="row">
                    <div className="col-xs-offset-2 col-xs-8">
                        <div className="page-header"><h2>React Router Demo</h2></div>
                    </div>
                </div>
                <div className="row">
                    <div className="col-xs-2 col-xs-offset-2">
                        <div className="list-group">
                            {/*原生中用a标签跳转*/}
                            {/*<a className="list-group-item active" href="./about.html">About</a>*/}
                            {/*<a className="list-group-item" href="./home.html">Home</a>*/}
                            {/*react中靠路由跳转切换组件，编写路由链接*/}


                                {/*NavLink会自动将选择的选项追加类名，默认是active,可以设置activeClassName更改*/}
                                <NavLink activeClassName="navlink" className="list-group-item" to="/about" >About</NavLink>
                                <NavLink activeClassName="navlink" className="list-group-item" to="/home" >Home</NavLink>
                        </div>
                    </div>
                        <Route path="/about" component={About}/>
                        <Route path="/home" component={Home}/>
                </div>
            </div>




        )
    }
}